<%@page import="com.glowdayz.common.PatternChecker"%>
<%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@page import="com.glowdayz.common.DBHandler"%>
<%@page import="com.glowdayz.common.ApiHandler"%>
<%@page import="com.glowdayz.common.ApiHandler.XmlData"%>
<%@page import="com.glowdayz.glowmee.cmd.RegisterCMD"%>
<%@page import="com.glowdayz.glowmee.dao.RegisterDAO"%>
<%@page import="java.util.ArrayList"%>
<%
	DBHandler.getInstance().connect();

	ApiHandler web = new ApiHandler(request, out, "JSPglowmee");
	
	PatternChecker checker = PatternChecker.getInstance();
	int id = web.getInt("id");
	String userTel = web.getValue("userTel");
	String userAddress = web.getValue("userAddress");
	
	if (!checker.isValue(userTel) ||!checker.isValue(userAddress)) {
		DBHandler.getInstance().disconnect();
		web.result(null, "회원번호나 연락처 또는 주소정보가 없습니다.");
		return;
	}
	
	int insert = 0;
	RegisterCMD cmd = new RegisterCMD(id, userTel, userAddress);
	insert = RegisterDAO.getInstance().moreInfoRegister(cmd);
	
	if (insert < 1) {
		DBHandler.getInstance().disconnect();
		web.result(null, "추가정보 입력에 실패하였습니다.");
		return;
	}
	
	DBHandler.getInstance().disconnect();
	
	ArrayList<XmlData> list = new ArrayList<XmlData>();
	list.add(new XmlData("seq", insert));
	web.result("SUCCESS", "추가정보가 입력되었습니다.", list);
%>